package com.jovan.bio;

import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author: Jovan
 * @date: 2025/6/22
 * @description:
 */
public class BioServer {

    public static void main(String[] args) throws Exception {
        ServerSocket serverSocket = new ServerSocket(8080);
        while (true) {
            Socket socket = serverSocket.accept();
            InputStream inputStream = socket.getInputStream();
            byte[] bytes = new byte[1024];
            int length;
            while ((length = inputStream.read(bytes)) != -1) {
                String message = new String(bytes, 0, length);
                System.out.println(message);
            }
            System.out.println("客户端断开连接！");
        }

    }
}
